package com.example.springboot.pattern;

import com.example.springboot.pattern.observer.EventPublisherService;
import com.example.springboot.pattern.observer.SpringObserverDemoApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringbootPatternApplication implements CommandLineRunner {

    @Autowired
    private EventPublisherService publisherService;

    public static void main(String[] args) {
        SpringApplication.run(SpringbootPatternApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        publisherService.publishCustomEvent("Hello, Spring Observers!");
    }
}
